package com.zc.framework.utils;

import org.apache.commons.beanutils.BeanUtilsBean;
import org.apache.commons.beanutils.ConvertUtils;
import org.apache.commons.beanutils.converters.BigDecimalConverter;
import org.apache.commons.beanutils.converters.DateConverter;

import java.lang.reflect.InvocationTargetException;

/**
 * Created by zc on 2016/9/28.
 */
public class BeanUtils extends org.apache.commons.beanutils.BeanUtils {


    public static void copyProperties(Object dest, Object orig)
            throws IllegalAccessException, InvocationTargetException {
        ConvertUtils.register(new DateConverter(null), java.util.Date.class);
        ConvertUtils.register(new BigDecimalConverter(null),java.math.BigDecimal.class);
        BeanUtilsBean.getInstance().copyProperties(dest, orig);
    }
}
